<template>
  <v-chart class="chart" :option="option" autoresize/>
</template>

<script setup lang="ts">
import VChart from "vue-echarts"
import {ref} from "vue"
import {defineModel} from 'vue'

const PieBooks = defineModel('books');
// option主要数据
const option = ref(
    {
      tooltip: {
        trigger: 'item'
      },
      legend: {
        top: '0%',
        left: 'center'
      },
      series: [
        {
          name: '借阅次数',
          type: 'pie',
          radius: ['40%', '70%'],
          center: ['50%', '60%'],
          avoidLabelOverlap: false,
          itemStyle: {
            borderRadius: 6,
            borderColor: '#fff',
            borderWidth: 2
          },
          label: {
            show: false,
            position: 'center'
          },
          emphasis: {
            label: {
              show: false,
              fontSize: 40,
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: PieBooks
        }
      ]
    }
);

</script>

<style scoped>
.chart {
  width: 100%;
  height: 500px;
}
</style>